/*Copyright (C) 2013-2021 LZE*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=22222222;
ll n,a[N],p[(N << 1) + 1],id,maxn;
int main(){
	string in,str = "?#";
	cin >> in; n = in.length();
	for(register ll i = 0;i < n;i++){str += in[i]; str += '#';}
	n = str.length();
	p[0] = 1; id = 0; maxn = 1;
	for(register ll i = 1;i < n;i++){
		p[id] + id > i ? p[i] = min(p[(id << 1) - i],p[id] + id - i) : p[i] = 1;
		for(;i - p[i] >= 0 && i + p[i] < n && str[i + p[i]] == str[i - p[i]];p[i]++);
		if(p[id] + id < p[i] + i)id = i;
        maxn = max(maxn,p[i]);
	}
	printf("%lld\n",maxn - 1);
	return 0;
}